package com.ims.core.doc.service;

import java.util.List;

import com.ims.core.doc.domain.TSalInvoice;
import com.ims.core.doc.domain.TSalInvoiceRedConfirm;
import com.ims.core.doc.domain.TScSettlebill;
import com.ims.core.doc.domain.TScSettlebillRequest;
import com.ims.core.vo.TSalInvoiceResponse;

/**
 * 销项发票Service接口
 *
 * @author IMS
 * @date 2024-05-07
 */
public interface ITSalInvoiceService
{
    /**
     * 查询销项发票
     *
     * @param id 销项发票主键
     * @return 销项发票
     */
    public TSalInvoice selectTSalInvoiceById(Long id);

    /**
     * 查询销项发票
     *
     * @param invoiceNo 发票号码
     * @return 销项发票
     */
    public TSalInvoice selectTSalInvoiceByInvoiceNo(String invoiceNo);

    /**
     * 查询销项发票
     *
     * @param id 销项发票主键
     * @return 销项发票
     */
    public TSalInvoiceResponse selectTSalInvoiceFullInfoById(Long id);

    /**
     * 查询销项发票
     *
     * @param id 销项发票主键
     * @param searchType
     * @return 销项发票
     */
    public TSalInvoice selectPreTSalInvoiceById(Long id, String searchType);

    /**
     * 查询销项发票
     *
     * @param id 销项发票主键
     * @param searchType
     * @return 销项发票
     */
    public TSalInvoice selectNextTSalInvoiceById(Long id, String searchType);

    /**
     * 查询销项发票列表
     *
     * @param tSalInvoice 销项发票
     * @return 销项发票集合
     */
    public List<TSalInvoice> selectTSalInvoiceList(TSalInvoice tSalInvoice);

    /**
     * 新增销项发票
     *
     * @param tSalInvoice 销项发票
     * @return 结果
     */
    public int insertTSalInvoice(TSalInvoice tSalInvoice);

    /**
     * 修改销项发票
     *
     * @param tSalInvoice 销项发票
     * @return 结果
     */
    public int updateTSalInvoice(TSalInvoice tSalInvoice);

    /**
     * 批量删除销项发票
     *
     * @param ids 需要删除的销项发票主键集合
     * @return 结果
     */
    public int deleteTSalInvoiceByIds(Long[] ids);



    /**
     * 批量销项发票开票
     *
     * @param ids 需要开票的销项发票主键集合
     * @return 结果
     */
    public void issueTSalInvoiceByIds(Long[] ids);

    /**
     * 批量销项发票红冲
     *
     * @param id 需要红冲的销项发票主键
     * @param reason 红冲原因
     * @return 结果
     */
    public TSalInvoiceRedConfirm redTSalInvoiceByIdAndReason(Long id, String reason);

    /**
     * 删除销项发票信息
     *
     * @param id 销项发票主键
     * @return 结果
     */
    public int deleteTSalInvoiceById(Long id);

    /**
     * 根据结算单生成待开发票
     * @param tScSettlebillRequest
     * @return
     */
    TSalInvoice createTSalInvoiceByTScSettlebill(TScSettlebillRequest tScSettlebillRequest);

    /**
     * 根据合并结算单生成待开发票
     * @param tScSettlebillRequest
     * @return
     */
    TSalInvoice createTSalInvoiceByMergeTScSettlebill(TScSettlebillRequest tScSettlebillRequest);

    /**
     * 根据发票号码同步发票并保存
     * @param taxNo  销方机构税号
     * @param applyNo  发票单号
     * @param invoiceNo  发票号码
     */
    void queryAndSaveInvoiceByInvoiceNo(String taxNo, String applyNo, String invoiceNo);

    /**
     * 根据发票号码请求版式生成
     * @param taxNo  销方机构税号
     * @param invoiceNo  发票号码
     */
    void formatCreateByInvoiceNo(String taxNo, String invoiceNo);

    /**
     * 填开一个销项发票
     * @param tSalInvoice  填开对象
     * @return  TSalInvoiceResponse 完整的发票对象
     */
    TSalInvoiceResponse writeAtSalInvoiceAndIssue(TSalInvoice tSalInvoice);

    /**
     * 同步发票
     * @param ids
     */
    void synctSalInvoiceByIds(Long[] ids);
}
